<%--
  Created by IntelliJ IDEA.
  User: 86153
  Date: 2023/3/9
  Time: 9:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>

<html>
<head>
  <base href="<%=basePath%>">
  <link href="css/haiersoft.css" rel="stylesheet" type="text/css" media="screen,print"/>
  <link href="css/print.css" rel="stylesheet" type="text/css" media="print"/>
  <link href="css/css.css" rel="stylesheet" type="text/css" media="print"/>
  <script src="js/jquery-1.10.1.min.js"></script>
  <script src="js/side.js" type="text/javascript"></script>
  <script src="js/jquery-3.6.0.js"></script>
  <script>
    function Update_Soldier(e){
      var formObject = {};
      var formArray =$("#form1").serializeArray();
      $.each(formArray,function(i,item){
        formObject[item.name] = item.value;
      });
      $.ajax({
        url:'soldier_info/Update_info',
        headers: {
          'Content-Type': 'application/json;charset=utf-8',
        },
        type:'POST',
        data:JSON.stringify(formObject),
        dataType: "json",
        success: function (data) {
          if (data.code == '0000') {
            console.log(data.message);
            alert("修改失败");
          } else if (data.code == '0001') {
            console.log(data.message);
            alert("修改成功");
            window.location.href='admin_info/View_Soldier';
          }else if (data.code == '0002') {
            alert("没有修改任何数据");
            window.location.href='admin_info/View_Soldier';
          }
        }
      })
    }
  </script>
</head>
<body>
<%
  String mobile = request.getParameter("mobile");
  String psStatus = request.getParameter("psStatus");
  String decommissioningTime = request.getParameter("decommissioningTime");
  String serviceTime = request.getParameter("serviceTime");
  String homeLocal = request.getParameter("homeLocal");
  String soldierOrigin = request.getParameter("soldierOrigin");
  String soldierAge = request.getParameter("soldierAge");
  String soldierName = request.getParameter("soldierName");
%>
<form id="form1">
  <div id="Popup">
    <div id="SubPopup" style="position: absolute; left: 500px;">
      <div class="form_boxC">
        <p>"<span class="f_cB">*</span>"号为不可修改项目</p>
        <table cellpadding="0" cellspacing="0">
          <tr>
            <th width="100">姓名 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:100px;">
                <input name="soldierName" type="text" size="5" value=<%=soldierName%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">年龄 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:100px;">
                <input name="soldierAge" type="text" size="5" value=<%=soldierAge%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">籍贯 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:230px;">
                <input name="soldierOrigin" type="text" size="20" value=<%=soldierOrigin%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">现住址 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:230px;">
                <input name="homeLocal" type="text" size="20" value=<%=homeLocal%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">服役时间 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:200px;">
                <input name="serviceTime" type="date" size="10" value=<%=serviceTime%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">退役时间 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:200px;">
                <input name="decommissioningTime" type="date" size="10" value=<%=decommissioningTime%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">工作状态 <span class="f_cB"></span></th>
            <td>
              <div class="txtbox floatL" style="width:200px;">
                <input name="psStatus" type="text" size="10" value=<%=psStatus%>>
              </div>
            </td>
          </tr>
          <tr>
            <th width="100">手机号 <span class="f_cB">*</span></th>
            <td>
              <div class="txtbox floatL" style="width:150px;">
                <input name="mobile" type="text" size="9" value=<%=mobile%> readonly>
              </div>
            </td>
          </tr>
        </table>
      </div>
      <div id="BtmBtn">
        <div class="btn_boxB floatR mag_l20">
          <span  style="cursor: pointer;background-color: #36c4aa;color: white;padding: 12px 20px;display: inline-block;font-size: 15px;position: absolute;width: 30px;left: 600px; height: 23px;" onclick="Update_Soldier()"><input type="hidden" />确定</span>
        </div>
        <div class="btn_box floatR">
          <button style="cursor: pointer;background-color: #36c4aa;color: white;padding: 12px 20px;display: inline-block;font-size: 15px;position: absolute;left: 700px;width: 75px;"><a style="color: white; text-decoration:none;" href="admin_info/View_Soldier">返回</a></button>
        </div>
      </div>
    </div>
  </div>
</form>
</body>
</html>

